<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/layui/layui.js"></script>
    <link rel="stylesheet" href="../js/layui/css/layui.css"/>
</head>
<body>
    <table class="layui-hide" id="yeWuTable" lay-filter="companyFilter"></table>
</body>
<script>
    var table;
    var $;
    layui.use(['table'], function() {
        table = layui.table;
        $ = layui.jquery;
        table.render({
            id:'yeWuTableId',
            elem: '#yeWuTable',
            fit: true,
            url: '../company/findTaoCan', //数据接口
            page: true,//开启分页
            limit:5,
            limits: [5,10,20,30,40,50],//page 代表当前页码、limit 代表每页数据量
            cols: [
                [ //表头
                    {type:'checkbox', fixed:'left'},
                    {field:'name', title:'套餐', align: 'center'},
                    {field:'count', title:'次数', align: 'center', sort:true},
                    {field:'price', title:'价格', align:'center', sort:true},
                    /*{field:'status', title:'天数', align:'center', sort:true,templet:function(data){
                        return data.status== 1 ? 30 : (data.status == 2 ? 365 : "");
                    }},*/
                    {fixed:'right',title: '操作',align:'center', toolbar:'#toolbar'}
                ]
            ]
        });
        table.on('tool(companyFilter)', function(obj){
            var data = obj.data;
            if(obj.event === 'edit'){
                var temp = 2;
                var price = data.price;
                var count = data.count;
                $.ajax({
                    url:'../zsl/adddingdan',
                    type:'post',
                    data:{price:price,count:count,temp:temp},
                    success:function (data) {
                        location.href='../goAlipay?price='+price;
                    }
                })
            }
        })
    })


</script>
<script type="text/html" id="toolbar">
    <a class="layui-btn layui-btn-xs" lay-event="edit">支付</a>
</script>
</html>